<%--
 *  File:    VisitPlanAddPop.jsp
 *  @Author: KentZhong 
 *  Date:    2009-10-9 10:02:44
 *
 *  Copyright (C) 2000 - 2009 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>


<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<%

  String strTableName = "v_visitplancustomer";
  String strModuleName = "SFE";
	String contextPath = request.getContextPath();
%>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<html>
<head>
<title><%=label.getLabelName("L_Add")%></title>
<%
if("Y".equals(request.getParameter("isconfirm"))){%>

%>
<script>
	opener.refreshWindow();
</script>
<%return;
}%>	
<PageFlow:CheckPageFlow pageName="p_visitplanselectcustomer"/>
<%@ include file="/inc/SumDiv.inc" %>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript">
<%--  put your custom script here   --%>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "VisitPlanSelectCustomer.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
function page_cancel()
{
	window.close();
}
function page_confirm()
{
	var myform = eval("document.cform");
	var details=eval("document.cform.customerids");
	
	
	if(isNullChecked(details))
  {
    alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
    return;
  }
  for(i=0;i<Number(myform.numrows.value);i++)
  {
  	var customer=eval("myform.customerid"+i);
  	var checkids=eval("myform.chkids"+i);
  	
		
  	if(!checkids.checked)
  	{
  		customer.value=" ";
  	}
  	else
  	{
  		
  		customer.value=checkids.value;
  		
  	}
  	
  }
  myform.actionname.value = "add";
 	myform.target="_self";
 	isRunning = true;
 	myform.submit();
}	


</script>
</head>
<body>
	<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_visitplanselectcustomer">
    <input type="hidden" name="actionname">
    <custom:hidden property="contactid"/>
    <custom:hidden property="orgid"/>
    <custom:hidden property="datetype"/>
    <input type="hidden" name="removedempty" value=" "/>
    <custom:hidden property="visitplantempletid"/>
    	
   <table width="100%" cellspacing="0" border="0" cellpadding="0">
      <tr>
<%--  search criteria  --%>
      </tr>
      <tr>
        <td>
          
          <table width="100%" border="0" cellspacing="0">
           
            <%@ include file="/inc/SummarySearch.inc" %>
            
            
          </table>
        </td>
      </tr>
      <tr>
        <td>
          <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
             <tr class="deepblue-left"> 
          			<td class="title_center" width="22">&nbsp;</td>
          			<td class="title_center" width="80"><%=label.getLabelName("L_CustomerCode")%></td>
          			<td class="title_center" ><%=label.getLabelName("L_CustomerName")%></td>
          			<td class="title_center" width="80"><%=label.getLabelName("L_GlobalPCName")%></td>
          			<td class="title_center" width="120"><%=label.getLabelName("L_ProcessName")%></td>
          			
          			
          	</tr>
          	<%
          		Vector vCustomers=(Vector)pageContext.getAttribute("customers");
          		if(vCustomers==null)
          			vCustomers=new Vector();
          		String strClassType = "none";	
          		
          	%>
          	 <logic:iterate id="customerinfo" collection="<%=vCustomers%>" indexId="idx">
          	 	<%
          	 	int seq=((Integer)pageContext.getAttribute("idx")).intValue();
          	 	 if(seq%2 == 1)
            {
              strClassType = "td-listrom";
            }else{
              strClassType = "none";
            }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
          	 	%>
          	 	<tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=strClassType%>'"   class="<%=strClassType%>" >
	 					  	<td>
	 					  		<input type="checkbox" name="customerids" id="chkids<%=seq%>" value="<custom:write name="customerinfo" property="orgid"/>" class="normalradio"/>
	 					  		<custom:hidden name="customerinfo"	 property="orgid" changedName="customerid" colIndex="<%=idx%>"/>	
	 					  		
									
	 					  	</td>
	 					  	<td><custom:write name="customerinfo"	 property="orgcode"/></td>
	 					  	<td><custom:write name="customerinfo"	 property="shortname"/></td>
	 					  	<td><custom:write name="customerinfo"	 property="globalpcname"/></td>
	 					  	<td><custom:select  name="customerinfo"	 property="defaultprocessid" changedName="processid"  optionsName="allprocesses" optionValueKey="visitprocessid" optionInnerTextKey="processname"  colIndex="<%=idx%>" /></td>
	 					  	
								
	 					  </tr>
          	 </logic:iterate>
          	<%@ include file="/inc/SummaryAction.inc" %>
          </table>
          <input type="hidden" name="numrows" value="<%=vCustomers.size()%>"/>
        </td>
      </tr>
      <tr>
      	<td>
      		<table width="100%" cellspacing="0" cellpadding="0">
            <tr><td class="summary_top"></td></tr>
            <tr>
              <td class="td_center">
             <a onclick="page_confirm();"><custom:button type="1" label="L_Confirm" imgsrc="new.gif" border="0" style="width:60"/></a>
                
                <a onclick="page_cancel();"><custom:button type="1" label="L_Cancel" imgsrc="Modify.gif" border="0" style="width:60"/></a>
                
               
              </td>
            </tr>
          </table>  
        </td>
      </tr>
    </table>
  </form>             	
</body>

</html>
	
